﻿using Microsoft.AspNetCore.Identity;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SRM.WebSite
{
    public class CustomerIdentityErrorDesriber: IdentityErrorDescriber
    {
        public override IdentityError PasswordMismatch()
        {
            return new IdentityError
            {
                Code = nameof(PasswordMismatch),
                Description = "密码错误"
            };
        }

        //public override IdentityError PasswordTooShort(int length)
        //{
        //    return new IdentityError
        //    {
        //        Code = nameof(PasswordTooShort),
        //        Description = $"密码至少是{length}字符"
        //    };
        //}

        //public override IdentityError PasswordRequiresNonAlphanumeric()
        //{
        //    //return base.PasswordRequiresNonAlphanumeric();
        //    return new IdentityError
        //    {
        //        Code = nameof(PasswordRequiresNonAlphanumeric),
        //        Description = "密码必须至少有一个非字母数字字符"
        //    };
        //}

        public override IdentityError PasswordRequiresUniqueChars(int uniqueChars)
        {
            // return base.PasswordRequiresUniqueChars(uniqueChars);
            return new IdentityError
            {
                Code = nameof(PasswordRequiresUniqueChars),
                Description = $"密码必须使用至少不同的{uniqueChars}字符。"
            };
        }
    }
}
